home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Readers / Gui4Cli / Dir / dir.gfxcon < prev    next >
Text File  |  1997-12-02  |  5KB  |  275 lines

  1. G4C  
  2.  
  3. ; dir.gfxcon - by dck January 1997
  4.  
  5. ; A GUI for the great picture format converter :
  6. ; GfxCon V1.7 © Dirk Farin / farindk@trick.informatik.uni-stuttgart.de 
  7. ; (Available on Aminet)
  8.  
  9. ; Looks for GFXcon under the name contained in variable $DEF.GFXCON
  10.  
  11.  
  12. WINBIG 180 15 200 166  "GfxCon V1.7"
  13. WinType 11110001
  14. varpath dir.gc
  15.  
  16. xOnLoad
  17. ifexists file $*DEF.GFXCON            ; you MUST have configured dir.gc
  18.     ; You're my kind of guy..
  19. else
  20.     EZReq "GFXcon not found!\nPlease configure\nDir.gc correctly." "OK" ""
  21.     guiquit dir.gfxcon
  22.     stop
  23. endif
  24. gfx_format = ILBM                       ; our variables
  25. gfx_colors = "" 
  26. gfx_bw     = ""
  27. gfx_flip   = ""
  28. gfx_rot    = ""
  29. gfx_x      = 320
  30. gfx_y      = 250
  31. gfx_size   = ""
  32. gfx_file   = ""
  33. gfx_mode   = FILES
  34. gosub dir.gfxcon FileMode
  35. guiopen dir.gfxcon
  36.  
  37. xOnClose
  38. delvar  gfx_#?
  39. guiquit dir.gfxcon
  40.  
  41. xRoutine FileMode
  42. setgad dir.gfxcon 1/13  HIDE
  43. setgad dir.gfxcon 21/25 SHOW
  44. redraw dir.gfxcon
  45.  
  46. xRoutine ConvertMode
  47. setgad dir.gfxcon 1/13  SHOW
  48. setgad dir.gfxcon 21/25 HIDE
  49. redraw dir.gfxcon
  50.  
  51. XCYCLER 0 0 200 14  "" gfx_mode
  52. cstr "Choose/Add Files"      FILES
  53. Cstr "Converting Options"    CONVERT
  54. if $gfx_mode = CONVERT
  55.    gosub dir.gfxcon ConvertMode
  56. else
  57.    gosub dir.gfxcon FileMode
  58. endif
  59.  
  60. ;------------------------------- PRETTY OBVIOUS OPTIONS GADGETS
  61.  
  62. XCYCLER 70 15 125 14  Format gfx_format
  63. GadID 1
  64. cstr ILBM ILBM
  65. cstr GIF  GIF
  66. cstr JPEG JPEG
  67. cstr PCX  PCX
  68. cstr PostScript Postscript
  69. cstr RGB-Raw   RGB-Raw
  70.  
  71.  
  72. XCYCLER 70 30 125 14  Colors gfx_colors
  73. GadId 2
  74. cstr Default ""
  75. cstr 16      16
  76. cstr 32      32
  77. cstr 128     128
  78. cstr 256     256
  79. cstr 2       2
  80. cstr 4       4
  81. cstr 8       8
  82.  
  83. XCYCLER 70 45 125 14  Type gfx_bw
  84. GadId 3
  85. cstr Default    ""
  86. cstr GRAYSCALE  GRAYSCALE
  87. cstr BW         BW
  88. cstr INVERT     INVERS
  89. cstr "NO Red"   NORED
  90. cstr "NO Green" NOGREEN
  91. cstr "NO Blue"  NOBLUE
  92.  
  93. XCYCLER 70 60 125 14  Flip gfx_flip
  94. gadid 11
  95. Cstr None  ""
  96. cstr "Flip X" FLIPX
  97. cstr "Filp Y" FLIPY
  98. cstr "Flip XY" "FLIPX FLIPY"
  99.  
  100. XCYCLER 70 75 125 14  Rotate gfx_rot
  101. gadid 12
  102. cstr None ""     
  103. cstr "90 Left"   ROTATELEFT
  104. cstr "90 Right"  ROTATERIGHT
  105.  
  106. ; NOT IMPLEMENTED YET
  107. ; slider contrast CONTRAST 0-100
  108. ; slider brightness BRIGHTNESS 0-255
  109.  
  110. ;---- Size
  111.  
  112. XCYCLER 70 90 125 14  Size gfx_size
  113. gadid 4
  114. cstr Same    ""
  115. cstr BOXFIT  BOXFIT
  116. cstr SIZE    SIZE
  117. if $gfx_size = NONE
  118.    setgad dir.gfxcon 5 OFF
  119.    setgad dir.gfxcon 6 OFF
  120. else
  121.    setgad dir.gfxcon 5 ON
  122.    setgad dir.gfxcon 6 ON
  123. endif
  124.  
  125. ; -- Size textin gadgets
  126. XTEXTIN 70 105 61 14  "" gfx_x 320 10
  127. gadid 5
  128. SetGad dir.gfxcon 6 ON
  129.  
  130. XTEXTIN 135 105 59 14  "" gfx_y 250 10
  131. gadid 6
  132.  
  133. ; -------------------- Status Boxes
  134.  
  135.  
  136. TEXT 5 112 40 10  "Status:" 20 NOBOX
  137. gadid 7
  138.  
  139. TEXT 4 123 190 12  "No Files" 130 BOX
  140. GadID 8
  141.  
  142. TEXT 4 136 190 12 "Idle.." 40 BOX
  143. gadid 13
  144.  
  145. xPIPE pipe:gfxcon ON
  146. if $gfx_mode = CONVERT
  147.    update dir.gfxcon 13 '$$PIPE'
  148. endif
  149.  
  150. ;--------------------- LISTVIEW SHOWING FILES TO CONVERT
  151.  
  152. XLISTVIEW 0 15 198 132  "" gfx_file "" 10 MULTI
  153. gadid 21
  154.  
  155. XBUTTON 0 150 50 14  View
  156. gadid 25
  157. lvuse dir.gfxcon 21
  158. lvmulti first
  159. while $gfx_file > ""
  160.    *RUNMODE  = 'run >nil:'
  161.    *FILENAME = $gfx_file
  162.    gosub viewfile.g ViewFile
  163.    lvmulti next
  164. endwhile
  165.  
  166. XBUTTON 50 150 50 14  Add            ; add files selected from dir.gc
  167. gadid 22
  168. id = $$lv.id
  169. lvuse dir.gc $id
  170. lvmulti first
  171. while $lv_file > ""
  172.    lvuse   dir.gfxcon 21
  173.    lvadd   $lv_file
  174.    lvuse   dir.gc $id
  175.    lvmulti off
  176.    lvmulti next
  177. endwhile
  178.  
  179. XBUTTON 100 150 50 14  Del           ; delete selected files
  180. gadid 23
  181. lvuse dir.gfxcon 21
  182. lvmulti first
  183. while $gfx_file > ""
  184.    lvdel -1
  185.    lvmulti first        ; use first again since last first was deleted
  186. endwhile
  187.  
  188. XBUTTON 150 150 50 14  Clr
  189. gadid 24
  190. lvuse dir.gfxcon 21
  191. lvclear
  192.  
  193.  
  194. ;-------------------- Cancel the relaunch of gfxcon
  195.  
  196. XBUTTON 100 150 95 14  CANCEL 
  197. gadfont topaz.font 8 010
  198. gadid 9
  199. gfx_flag = 1
  200.  
  201.  
  202. ;-------------------- This is where we do our stuff!
  203.  
  204. XBUTTON 5 150 95 14  "Convert"
  205. gadid 10
  206. gadfont topaz.font 8 010
  207. gfx_flag = 0
  208. lvuse dir.gfxcon 21
  209. lvgo #0
  210. gfx_cfile = $$lv.rec
  211. if $gfx_cfile > ""
  212.    lvdel  0
  213.    update dir.gfxcon 7 Converting:
  214.    update dir.gfxcon 8 $gfx_cfile
  215.    gosub  dir.gfxcon makecom
  216.    setstack 20000
  217.    Launch 1 '$*DEF.GFXCON >pipe:gfxcon $gfx_cfile $gfx_com'
  218.    setstack 4000
  219. endif
  220.  
  221. ; This is where the Launch command will return to when the program
  222. ; it has run has finished executing. We then tell it to do it again
  223.  
  224. xOnReturn 1
  225. if $gfx_mode = CONVERT
  226.    update dir.gfxcon 13 Idle
  227.    update dir.gfxcon 7  Status:
  228.    update dir.gfxcon 8  Finished
  229. endif
  230. if $gfx_flag = 1
  231.    stop
  232. endif
  233. lvuse dir.gfxcon 21
  234. lvgo #0
  235. gfx_cfile = $$lv.rec
  236. if $gfx_cfile > ""
  237.    lvdel  0
  238.    update dir.gfxcon 7 Converting:
  239.    update dir.gfxcon 8 $gfx_cfile
  240.    gosub  dir.gfxcon makecom
  241.    setstack 20000
  242.    Launch 1 '$*DEF.GFXCON >pipe:gfxcon $gfx_cfile $gfx_com'
  243.    setstack 4000
  244. endif
  245.  
  246.  
  247. ; ------------ Routine to form command line
  248.  
  249. xroutine makecom
  250. gfx_com = 'FORMAT $gfx_format'
  251. if $gfx_colors > ""
  252.    appvar gfx_com ' COLORS $gfx_colors'
  253. endif
  254. if $gfx_bw > ""
  255.    appvar gfx_com ' $gfx_bw'
  256. endif
  257. if $gfx_flip > ""
  258.    appvar gfx_com ' $gfx_flip'
  259. endif
  260. if $gfx_rot > ""
  261.    appvar gfx_com ' $gfx_rot'
  262. endif
  263. if $gfx_size > ""
  264.    appvar gfx_com ' $gfx_size $gfx_x $gfx_y'
  265. endif
  266.  
  267.  
  268. ; --------------
  269. ; This is where we'll end up if anything goes wrong..
  270. ; i.e. such as GFXcon not finding the file and returning an error status
  271.  
  272. xOnFail
  273. EZReq  "An error occured.\nClick on Convert to continue." "OK" ""
  274.  
  275.